package luogu;

import java.util.Scanner;

public class Main1157 {
    static int n;
    static int r;
    static int[] arr;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        r = sc.nextInt();
        arr = new int[r];
        backtrack(1, 0);
    }

    public static void backtrack(int start, int index) {
        if (index == r) {
            for (int i = 0; i < r ; i++) {
                System.out.printf("%3d",arr[i]);
            }
            System.out.println();
            return;
        }

        for (int i = start; i <= n; i++) {
            arr[index] = i;
            backtrack(i + 1, index + 1);
        }
    }
}
